﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfAddRoute.aspx.cs" Inherits="msBsc.WebUi.ShpMana.wfAddRoute" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加旅游路线</title>
    <link href="/themes/wStyle1/css/sLayout.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sHead.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/sFoot.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/usermenu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/from.css" rel="stylesheet" />
    <link href="/jqPlugin/hdfu/hdfu.css" rel="stylesheet" />
    <link href="/themes/wStyle1/css/Seller/sReleaseForum.css" rel="stylesheet" />
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <link href="/jqPlugin/layer/skin/layer.css" rel="stylesheet" />
    <style type="text/css">
        .texarea {
            width: 648px;
            height: 150px;
        }

        #logo_img_selected img {
            max-height: 300px;
            /*max-width:150px;*/
        }

        .selCondition li {
            background-color: #f5f5f5;
            border: 1px solid #f5f5f5;
            float: left;
            line-height: 20px;
            margin-right: 5px;
            margin-top: 3px;
            padding: 4px 10px;
        }

        .divMaxCondition {
            display: inline;
            float: left;
            text-align: left;
            width: 720px;
        }

        .cancel {
            cursor: pointer;
            padding-left: 5px;
        }

        .additem {
            margin-left: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="wf_all">
        <div class="main-container">
            <div class="main-Info" style="margin-bottom: 200px;">
                <div class="main-horizontal">
                    <div class="r_row">
                        <span class="control-span">路线封面<span class="required">*</span></span>
                        <div class="controls">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        <div id="logo_img_selected">
                                            <img id="uHeadImg" src="/themes/Style1/Image/u_head_110x110.png" for="" />
                                        </div>
                                    </td>
                                    <td style="padding: 3px;">
                                        <div style="padding: 5px;">
                                            <a id="btnupImg" target="_self" value="上传图片" style="margin: 6px; cursor: pointer;" onclick="javascript:return false;">上传图片</a>
                                            <p>
                                                文件大小不能大于1M
                                            </p>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">路线名称<span class="required">*</span></span><div class="controls">
                            <input type="text" id="title" class="input titleInput" />
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">路线简介<span class="required">*</span></span>
                        <div class="controls">
                            <textarea name="content" id="txtInfo" class="texarea"></textarea>
                        </div>
                    </div>
                    
                     <div class="r_row">
                        <span class="control-span">线路日程<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="NumberDays" value="3" class="input titleInput" />
                            <span id="Span1" class="help-inline">路线行程天数</span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">主要景点<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="characteristic" class="input titleInput" />
                            <span id="forumInfoMessage" class="help-inline">主要景点名称</span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">地区<span class="required">*</span></span>
                        <div class="controls">
                            <select class="selArea" id="selCountry">
                                <option value="0">请选择</option>
                                <option value="DF6723BE-A25C-4F77-BB49-A1662D3E6F2A">中国</option>
                                <option value="453370FE-8295-41EC-A41C-B6F650AD1B4C">亚洲</option>
                                <option value="927D5F28-C4FB-46A9-940C-B07DF0A04018">北美洲</option>
                                <option value="1FEAF456-7C76-41C8-A3D0-F9C12415A736">南美洲</option>
                                <option value="4E2B4524-E9CB-4E20-9224-E58EB636D1C7">非洲</option>
                                <option value="67FA6A8D-951C-4B53-AE1E-70DCB97E11DE">欧洲</option>
                                <option value="0B772F3D-D8F8-42E3-9019-81FE6F772236">大洋洲</option>
                            </select>
                            <select class="selArea" id="selCity">
                                <option value="0">请选择</option>
                            </select>
                            <xmp id="country_city_list" style="display: none">
                                <option value="0">请选择</option>
                                {{#for(var i=0,len=d.rows.length;i < len;i++){ }}
                                       <option value="{{d.rows[i].COUNTRY_CITY_ID}}">{{d.rows[i].COUNTRY_CITY_NME}}</option>
                                {{#} }}        
                            </xmp>
                            <select class="selArea" id="selDestination">
                                <option value="0">请选择</option>
                            </select>
                            <xmp id="city_des_list" style="display: none">
                               <option value="0">请选择</option>
                               {{#for(var i=0,len=d.rows.length;i < len;i++){ }}
                                <option value="{{d.rows[i].COUNTRY_CITY_ID}}">{{d.rows[i].COUNTRY_CITY_NME}}</option>
                               {{#} }}
                            </xmp>
                        </div>
                    </div>
                    
                    <div class="r_row">
                        <span class="control-span">预定说明<span class="required">*</span></span>
                        <div class="controls">
                            <textarea name="content" id="routeJianjie" class="bianji"></textarea>
                            <span class="help-inline"></span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">路线价格<span class="required">*</span></span>
                        <div class="controls">
                            <input type="text" id="routePrice" value="300.00" />
                            <span class="help-inline"></span>
                        </div>
                    </div>
                    <div class="r_row">
                        <span class="control-span">设为推荐<span class="required">*</span></span>
                        <div class="controls">
                             <input type="radio" name="Recommend"  value="1"  /><label>是</label>
                            <input type="radio" name="Recommend" value="0" checked="checked" /><label>否</label>
                        </div>
                    </div>
                    <div style="text-align: center; margin-top: 20px;">
                        <input type="button" onclick="AddRoute();" class="releaseBtn" style="margin-right: 20px;" value="发布" />
                    </div>
                </div>
            </div>
        </div>
        <!--start JS引用-->
        <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
        <script src="/jqPlugin/js/jBase.js"></script>
        <script src="/jqPlugin/js/jBPage.js"></script>
        <script src="/jqPlugin/js/laytpl.js"></script>
       <script src="/jqPlugin/layer/layer.min.js"></script>

        <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
        <script src="/jqPlugin/SelectSimu/js/SelectSimu.js"></script>
        <script src="/themes/wStyle1/js/comm/jsLayout.js"></script>

         <script charset="utf-8" src="/jqPlugin/kindeditor/kindeditor.js"></script>
        <script charset="utf-8" src="/jqPlugin/kindeditor/lang/zh_CN.js"></script>
        <!--end JS引用-->
        <script type="text/javascript">
            function SetAreaInfo() {
                $("#selCountry").change(function () {
                    $("#selCity").html("<option value='0'>请选择</option>");
                    $("#selDestination").html("<option value='0'>请选择</option>");
                    var _opartParam = new jsonRow();
                    _opartParam.AddCell("countryId", $("#selCountry").val());
                    _opartParam.AddCell("cityId", $("#selCity").val());
                    _opartParam.AddCell("ACTION", "changeArea");
                    ajaxComm(_opartParam);
                })

                $("#selCity").change(function () {
                    $("#selDestination").html("<option value='0'>请选择</option>");
                    var _opartParam = new jsonRow();
                    _opartParam.AddCell("cityId", $("#selCity").val());
                    _opartParam.AddCell("ACTION", "changeArea");
                    ajaxComm(_opartParam);
                })
            }
            SetAreaInfo();

            K = KindEditor;
            //        K.DEBUG = true;
            K.basePath = K.options.basePath = '/jqPlugin/kindeditor/';
            K.options.themesPath = K.options.basePath + 'themes/';
            K.options.langPath = K.options.basePath + 'lang/';
            K.options.pluginsPath = K.options.basePath + 'plugins/';
            function getfilequery() {
                return "&ParentId=" + "&FileId=" + ""
                                        + "&RelId=" + ""
                                        + "&rType1=" + "0"
                                        + "&rType2=" + "0";
            };

            var editorContend;
            function SetEditHtml(_sHtml) {
                scontenthtml = _sHtml;
            };
            var scontenthtml = '';
            $(window).load(function () {

                editorContend = K.create('#routeJianjie', {
                    allowFileManager: true,
                    resizeType: 2,
                    allowPreviewEmoticons: true,
                    allowImageUpload: true,
                    loadStyleMode: false,
                    designMode: true,
                    afterCreate: function () {
                    }
                });

                editorContend.fileManagerJson = '/pgajax.axd?F_MANA=1&rType1=0&rType2=0&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                        + "&fType=" + "mana";
                editorContend.uploadJson = '/pgajax.axd?F_UPLOAD=1&blSave=1&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                        + "&fType=" + "mana"
                                        + getfilequery();

                $.ploadFile("kindeditor", function (script, textStatus) {
                    $.setUploadFile('btnupImg', { FileId: '', RelId: "", rType1: '0', rType2: '' }, function (data) {
                        if (data.url) {
                            $('#logo_img_selected').empty().html('<img alt="" src="' + data.url + '" for="' + data.url + '">');
                        }
                    });
                });
            });

            function doBoundContent(_shopurl) {
                if (_shopurl != null && _shopurl != undefined && _shopurl != '') {
                    jQuery.loadHtml(_shopurl).done(function (_rethtml) {
                        var tpl = HtmlUtil.htmlDecode(_rethtml);
                        scontenthtml = tpl;
                        editorContend && editorContend.html(tpl);
                    });
                }
            };

            //执行AJAX调用时获取参数
            function AddRoute() {

                editorContend.sync();

                //论坛标题
                var routeTitle = $.trim($("#title").val());
                if (IsNull(routeTitle)) {
                    layer.alert('请填写标题.', 3);
                    return;
                }
                //线路日程
                var NumberDays = $("#NumberDays").val();
                if (IsNull(routeTitle)) {
                    layer.alert('线路日程.', 3);
                    return;
                }
                NumberDays = parseInt(NumberDays);
                if (NumberDays<1) {
                    layer.alert('线路日程必须大于一天.', 3);
                    return;
                }
                
                //主要景点
                var characteristic = $.trim($("#characteristic").val());
                if (IsNull(characteristic)) {
                    layer.alert('请填写主要景点.', 3);
                    return;
                }
                //简介
                var txtInfo = $.trim($("#txtInfo").val());
                if (IsNull(txtInfo)) {
                    layer.alert('请填写简介.', 3);
                    return;
                }
               
                //路线说明
                var routeJianjie = $("#routeJianjie").val();
                if (IsNull(routeJianjie)) {
                    layer.alert('请填写路线介绍.', 3);
                    return;
                }
                //是否推荐
                var ispush=$("input[name='Recommend']:checked").val();

                var countryId = $("#selCountry").val();
                var cityId = $("#selCity").val();
                var destinationId = $("#selDestination").val();
                if (countryId == "0" || cityId == "0") {
                    layer.alert('请选择地区.', 3);
                    return;
                }
                //价格
                var price = $("#routePrice").val();
                if (IsNull(price)) {
                    layer.alert('请输入价格.', 3);
                    return;
                }

                //首图
                var shoutu = $("#logo_img_selected").children().eq(0).attr("for");
                if (IsNull(shoutu)) {
                    layer.alert('请选择首图.', 2);
                    return;
                }
                layer.load('正在保存中…',2);
                var _jsParam = new jsonRow();

                _jsParam.AddCell("routeTitle", routeTitle);
                _jsParam.AddCell("routeJianjie", routeJianjie);

                _jsParam.AddCell("characteristic", characteristic);
                _jsParam.AddCell("txtInfo", txtInfo);
                _jsParam.AddCell("numberDays", NumberDays);

                _jsParam.AddCell("countryId", countryId);
                _jsParam.AddCell("cityId", cityId);
                _jsParam.AddCell("destinationId", destinationId);

                _jsParam.AddCell("routePrice", price);
                _jsParam.AddCell("shoutu", shoutu);

                _jsParam.AddCell("countryName", $("#selCountry").find("option:selected").text());
                _jsParam.AddCell("cityName", $("#selCity").find("option:selected").text());
                _jsParam.AddCell("destinationName", $("#selDestination").find("option:selected").text());

                _jsParam.AddCell("ispush", ispush);

                _jsParam.AddCell("ACTION", "saveRoute");


                ajaxComm(_jsParam);
            };
            function success() {
                layer.alert('添加成功', 1);
                setTimeout(function () {
                    location.reload();
                }, 2000);
            }
        </script>
    </div>
</body>
</html>
